﻿using System;
using System.Collections;
using UnityEngine;

// Token: 0x0200005F RID: 95
public class EndFrameToScreenShot : MonoBehaviour
{
	// Token: 0x0600030E RID: 782 RVA: 0x000142D8 File Offset: 0x000124D8
	private void LateUpdate()
	{
		if (Input.GetKeyDown(this.ssKey))
		{
			ScreenShotCamera ss = UnityEngine.Object.Instantiate<ScreenShotCamera>(this.ssCam);
			base.StartCoroutine(this.ReadPixEndFrame(ss));
		}
	}

	// Token: 0x0600030F RID: 783 RVA: 0x00014310 File Offset: 0x00012510
	private IEnumerator ReadPixEndFrame(ScreenShotCamera ss)
	{
		yield return new WaitForEndOfFrame();
		Texture2D tex2D = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);
		tex2D.filterMode = FilterMode.Point;
		tex2D.wrapMode = TextureWrapMode.Clamp;
		tex2D.ReadPixels(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), 0, 0, false);
		tex2D.Apply();
		ss.Shot(tex2D);
		yield break;
	}

	// Token: 0x040002C3 RID: 707
	public ScreenShotCamera ssCam;

	// Token: 0x040002C4 RID: 708
	public KeyCode ssKey = KeyCode.F11;
}
